<?php

$header = <<<EOD
<html>
<head>
	<title>Versions!</title>
	<link rel="stylesheet" href="css/style.css" type="text/css" />
	<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
	<script type="text/javascript" src="js/cufon-yui.js"></script>
	<script type="text/javascript" src="js/WalkwayUltraBold_400.font.js"></script>
	<script type="text/javascript" src="js/WalkwayCondensedBold_400.font"></script>
	<script type="text/javascript">
           Cufon.replace('.title', { fontFamily: 'WalkwayUltraBold'});
	</script>
</head>
<body>
	<div class="header"></div>
	<div class="content">
		<p><span class="title">%TITLE%</p>
		<p>
EOD;

$footer = <<<EOD
</p>
		</div>
		</body>
	</html>
EOD;



function getHeader($title){
	global $header;
	return str_replace("%TITLE%", $title, $header);
}


function getFooter() {
	global $footer;
	return $footer;
}


function getErrorMessage($code){
	switch ($code){
		case 0:
			return "Unknown error.";
		case 1:
			return "Can't write config.ini file.";
		case 2:
			return "MySQL Database connection error: ";
		case 3:
			return "Versions is already configured.<br />To restart configuration from scratch remove config.ini file and reload current page.";
		case 4:
			return "Can't create MySQL tables.";
		case 5:
			return "Missing POST parameters.";
		case 6:
			return "Versions isn't configured.<br /><a href='install.php'>Go to installation page</a>";
	}
}


function getErrorPage($errorCode, $errorMessage = ""){
	$str = getHeader("Versions Installation Error");
	$str .= getErrorMessage($errorCode) . $errorMessage;
	$str .= getFooter();

	return $str;
}



?>

			


